# coding=utf-8
# Copyright (C) xxx team - All Rights Reserved
# 
# @Version:   3.10.4
# @Software:  PyCharm
# @FileName:  utils.py
# @CTime:     2022/8/4 22:12   
# @Author:    yhy
# @Email:     yhy@yhy.com
# @UTime:     2022/8/4 22:12
# 
# @Description:
# 
#     xxx
# 
import codecs
import logging
from typing import List, Dict, Optional

logger = logging.getLogger(__name__)



def weights_update(model, checkpoint):
    model_dict = model.state_dict()
    pretrained_dict = {k: v for k, v in checkpoint['state_dict'].items() if k in model_dict}
    model_dict.update(pretrained_dict)
    model.load_state_dict(model_dict)
    return model






if __name__ == '__main__':
    pass
